<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: SXLWTT
  Date: 2021/11/1
  Time: 9:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="/js/jquery-1.9.1.min.js"></script>
    <script src="/js/fileupload.js"></script>
    <link rel="stylesheet" href="/css/css.css">
</head>
<body>
<table>
    <tr>
        <td colspan="11">
            <form action="/list.do" method="post">
                <input type="hidden" name="pageNum">
                执业资格证书编号：<input type="text" name="practice" value="${map.practice}">
                日期：<input type="text" name="adateX" value="${map.adateX}">
                        <input type="text" name="adateD" value="${map.adateD}">
                会计分类：
                <select name="tid">
                    <option value="">----</option>
                </select>

                <input type="submit" value="查询"><a href="/list.do">刷新 </a>
            </form>
        </td>
    </tr>
    <tr>
        <td>
            <input type="checkbox" name="one" onclick="onee()">
        </td>
        <td>编号</td>
        <td>姓名</td>
        <td>性别</td>
        <td>省市</td>
        <td>申请注册单位</td>
        <td>会计分类</td>
        <td>执业资格证书编号</td>

        <td>注册号</td>
        <td>有效期</td>
        <td>操作</td>
    </tr>
    <c:forEach items="${pageInfo.list}" var="li">
        <tr>
            <td>
                <input type="checkbox" name="two" value="${li.aid}">
            </td>
            <td>${li.aid}</td>
            <td>${li.aname}</td>
            <td>${li.sex}</td>
            <td>${li.sheng}</td>
            <td>${li.apply}</td>
            <td>${li.tname}</td>
            <td>${li.practice}</td>
            <td>${li.number}</td>
            <td>${li.adate}</td>
            <td>
                --
            </td>

        </tr>
    </c:forEach>
    <tr>
        <td colspan="12">
                <a href="javaScript:qwe(1)">首页</a>
                <a href="javaScript:qwe(${pageInfo.isFirstPage?1:pageInfo.prePage})">上一页</a>
                <a href="javaScript:qwe(${pageInfo.isLastPage?pageInfo.pages:pageInfo.nextPage})">下一页</a>
                <a href="javaScript:qwe(${pageInfo.pages})">尾页</a>
            <input type="button" value="添加" onclick="add()">
            <input type="button" value="批量删除" onclick="delall()">
        </td>
    </tr>
</table>
</body>
</html>
<script>
    function onee() {
        $("[name='one']").change(function () {
            $("[name='two']").prop("checked",$(this).prop("checked"))
        })
    }
    function delall() {
     var aaa=   $("[name='two']:checked").map(function () {
            return $(this).val()
        }).get().toString()

        alert(aaa)
        $.ajax({
            url:"delAll.do",
            data:{aid:aaa},
            type:"post",
            dataType:"json",
            success:function (obj) {
                if (obj>0){
                    alert("删除成功")
                    location="list.do"
                }
            }
        })
    }

    function qwe(pageNum) {
        $("[name='pageNum']").val(pageNum)
        $("form").submit()
    }
    $.ajax({
        url:"listType.do",
        type:"post",
        dataType:"json",
        success:function (obj) {
            for (var i in obj ){
                $("[name='tid']").append("<option value='"+obj[i].tid+"'>"+obj[i].tname+"</option>")
            }
        }
    })
    function add() {
        location="toadd.do"
    }
</script>
